﻿<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="systemAdmin.aspx.vb" Inherits="projectBiome.WebForm2" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script src="./jquery-1.2.6.pack.js" type="text"></script>
<script runat="server">
    'Show add System Multiview
    Sub addSystemShow(ByVal sender As Object, _
                     ByVal e As EventArgs)
        addModifyView.ActiveViewIndex = "1"
    End Sub
    Sub removeSystemShow(ByVal sender As Object, _
                 ByVal e As EventArgs)
        addModifyView.ActiveViewIndex = "2"
    End Sub
    'Show modify System MultiView
    Sub modifySystemShow(ByVal sender As Object, _
                     ByVal e As EventArgs)
        addModifyView.ActiveViewIndex = "0"
    End Sub
    'Move item from available box to system box (ModifyView)
    Sub moveLeftModify(ByVal sender As Object, _
                          ByVal e As EventArgs)
        moveAttribute("left", "modify")
    End Sub
    
    'Move item from available box to system box (ModifyView)
    Sub moveLeftAdd(ByVal sender As Object, _
                          ByVal e As EventArgs)
        moveAttribute("left", "add")
    End Sub
    'ReMove item from system box (ModifyView)
    Sub moveRightModify(ByVal sender As Object, _
                          ByVal e As EventArgs)
        moveAttribute("right", "modify")
    End Sub
    'Remove item from system box (AddView)
    Sub moveRightAdd(ByVal sender As Object, _
                         ByVal e As EventArgs)
        moveAttribute("right", "add")
    End Sub
    'Delete System
    Sub deleteSystem(ByVal sender As Object, _
                     ByVal e As EventArgs)
        deleteSysSQL
    End Sub
    
    'Go to Card Management
    Sub goToCardMgmt(ByVal sender As Object, _
                     ByVal e As EventArgs)
        Response.Redirect("./cardAdmin.aspx")
    End Sub
    'Go to Index Page
    Sub returnIndex(ByVal sender As Object, _
                    ByVal e As EventArgs)
        Response.Redirect("./indexAdmin.aspx")
    End Sub
    
</script>
        
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>System</title>
   
    
    <style type="text/css">
        #addSystem
        {
            width: 130px;
        }
        .style2
        {
            font-family: Calibri;
        }
        #Text1
        {
            width: 145px;
        }
        .style4
        {
            background-color: #FFFFFF;
        }
        .style8
        {
            font-family: Calibri;
            background-color: #FFFFFF;
            width: 224px;
            text-align: left;
        }
        .style10
        {
            font-family: Calibri;
            text-align: center;
        }
        .style18
        {
            font-family: Calibri;
            width: 317px;
        }
        .style19
        {
            width: 317px;
            text-align: left;
            background-color: #CCCCCC;
        }
        .style25
        {
            width: 112px;
            height: 23px;
            background-color: #CCCCCC;
        }
        .style28
        {
            background-color: #FFFFFF;
        }
        .style34
        {
            width: 158px;
        }
        .style41
        {
            height: 23px;
            width: 222px;
            text-align: center;
            background-color: #CCCCCC;
        }
        #SystemNameModify
        {
            text-align: left;
        }
        .style43
        {
            width: 33px;
        }
        .style54
        {
            height: 23px;
            width: 48px;
            text-align: center;
            background-color: #CCCCCC;
        }
        .style56
        {
            height: 23px;
            width: 112px;
            text-align: center;
            background-color: #CCCCCC;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div class="style2" style="text-align: center">
    
        <h1>
            System Administration</h1>
        <p>
            <asp:Image ID="Image1" runat="server" Height="146px" 
                ImageUrl="../images/img_environment_header.jpg" Width="413px" />
        </p>
    
    </div>
    <p style="background-color: #CCCCCC">
        <asp:LinkButton ID="linkHomelnkbtn" runat="server" 
            PostBackUrl="./indexAdmin.aspx">Index</asp:LinkButton>
&nbsp;&gt; System Administration</p>
    <table style="width: 100%;">
        <tr>
            <td class="style10">
                <asp:ImageButton ID="cardMgmtBtn" runat="server" Height="107px" onClick = "goToCardMgmt"
                    ImageUrl="../images/cardsIcon.jpg" Width="94px" />
                <asp:ImageButton ID="removeSystemBtn" runat="server" 
                    ImageUrl="../images/removeSystem.jpeg" OnClick = "removeSystemShow"/>
                <asp:ImageButton ID="addSystemBtn" runat="server" 
                    ImageUrl="../images/addSystem.jpeg"  OnClick = "addSystemShow" 
                    style="margin-left: 0px; text-align: center;" ToolTip="Add A New System" />
                <asp:ImageButton ID="modifySystemBtn" runat="server" OnClick = "modifySystemShow" Height="103px" 
                    ImageUrl="../images/modifySystem.jpeg" Width="113px" 
                    ToolTip="Modify System"/>
                <asp:ImageButton ID="returnBtn" runat="server"
                    ImageUrl="../images/backIcon.jpg" Width="89px" 
                    onClick = "returnIndex" />
                <br />
                <br />
                <div></div>
            </td>
        </tr>
    </table>
    <asp:MultiView ID="addModifyView" runat="server" ActiveViewIndex="0">
        <asp:View ID="modifySystem" runat="server">
            <table style="width: 91%;">
                <tr>
                    <td style="text-align: center">
                        <h1 class="style8">
                            Modify System</h1>
                    </td>
                </tr>
                <tr>
                    <td class="style4">
                        <span class="style2">Choose System:</span><br />
                        <asp:DropDownList ID="SystemDropDown" runat="server" OnSelectedIndexChanged="selectIndexChanged"
                            DataSourceID="SqlDataSource1" DataTextField="SystemName" 
                            DataValueField="SystemID" Height="40px" AutoPostBack="True">
                            <asp:ListItem Value="1">Default</asp:ListItem>
                        </asp:DropDownList>
                        <br />
                        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                            ConnectionString="<%$ ConnectionStrings:FA11_4396_allConnectionString %>" 
                            SelectCommand="SELECT [SystemName], [SystemID] FROM [System]">
                        </asp:SqlDataSource>
                    </td>
                    <td>
                        <asp:Panel ID="Panel1" runat="server" Height="244px" 
                            style="background-color: #FFFFFF; text-align: left;">
                            System Name:<br />
                            &nbsp;<asp:TextBox ID="systemNameModifyTxt" runat="server" AutoPostBack="True"></asp:TextBox>
                            <br />
                            <br />
                            <table style="width:100%;">
                                <tr>
                                    <td class="style34">
                                        <asp:ListBox ID="systemAttributeBox" runat="server" Width="236px" 
                                            SelectionMode="Multiple"></asp:ListBox>
                                    </td>
                                    <td class="style43">
                                        <asp:Button ID="moveAttribLeftBtn"  OnClick="moveLeftModify" runat="server" Text="&lt;&lt;" 
                                            style="text-align: center" />
                                        <br />
                                        <asp:Button ID="moveAttribRightBtn" OnClick="moveRightModify" runat="server" Text="&gt;&gt;" 
                                            style="text-align: center" />
                                        <br />
                                    </td>
                                    <td>
                                        <asp:ListBox ID="availableAttributeBox" runat="server" Width="273px"></asp:ListBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="style34">
                                        System Attributes</td>
                                    <td class="style43">
                                        &nbsp;</td>
                                    <td>
                                        Available Attributes</td>
                                </tr>
                                <tr>
                                    <td class="style34">
                                        &nbsp;</td>
                                    <td class="style43">
                                        &nbsp;</td>
                                    <td>
                                        &nbsp;</td>
                                </tr>
                                <tr>
                                    <td class="style34">
                                        <asp:Button ID="saveModify" OnClick="saveChangesModify" runat="server" 
                                            Text="Save" Width="42px" />
                                    </td>
                                    <td class="style43">
                                        &nbsp;</td>
                                    <td>
                                     
                                        &nbsp;</td>
                                </tr>
                            </table>
                        </asp:Panel>
                    </td>
                </tr>
                <tr>
                    <td class="style28">
                        &nbsp;</td>
                    <td class="style28">
                        &nbsp;</td>
                </tr>
            </table>
        </asp:View>
    <asp:View ID="addSystem" runat="server">
        <table style="width:91%;">
            <tr>
                <td class="style18" colspan="2">
                    <h1 class="style8">
                        Add New System</h1>
                </td>
            </tr>
            <tr>
                <td class="style19" colspan="3">
                    System Name</td>
            </tr>
            <tr>
                <td class="style19" colspan="3">
                    &nbsp;<asp:TextBox ID="systemNameAddTxt" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="style56">
                    System Attributes</td>
                <td class="style54">
                    &nbsp;</td>
                <td class="style41">
                    Available Attributes</td>
            </tr>
            <tr>
                <td class="style56">
                    <asp:ListBox ID="SystemAttributesList" runat="server" Width="232px" 
                        style="margin-left: 0px" SelectionMode="Multiple">
                    </asp:ListBox>
                    <br />
                </td>
                <td class="style54">
                    <br />
                    <asp:Button ID="leftAddSystem" OnClick="moveLeftAdd" runat="server" style="text-align: center" 
                        Text="&lt;&lt;" />
                    <br />
                    <asp:Button ID="rightAddSystem" OnClick="moveRightAdd" runat="server" style="text-align: center" 
                        Text="&gt;&gt;" />
                </td>
                <td class="style41">
                    <asp:ListBox ID="AvailableAttribList" runat="server" 
                        Width="231px"></asp:ListBox>
                </td>
            </tr>
            <tr>
                <td class="style25">
                    <asp:Button ID="saveAddBtn" OnClick="saveAdd" runat="server" Text="Save" />
                </td>
                <td class="style54">
                    &nbsp;</td>
            </tr>
        </table>
        </asp:View>
            <asp:View ID="removeSystem" runat="server">
        <table style="width:91%;">
            <tr>
                <td class="style18">
                    <h1 class="style8">
                        Delete System</h1>
                    <p class="style8">
                        Choose System:</p>
                    <p class="style8">
                        <asp:DropDownList ID="removeDropDownLst" runat="server" 
                            DataSourceID="SqlDataSource1" DataTextField="SystemName" 
                            DataValueField="SystemID">
                        </asp:DropDownList>
                    </p>
                    <p class="style8">
                        <asp:Button ID="deleteSystemBtn" runat="server" Text="Remove System" OnClick="deleteSystem"/>
                    </p>
                </td>
            </tr>
            <tr>
                <td class="style19">
                    &nbsp;</td>
            </tr>  
            </table>              
        </asp:View>
    </asp:MultiView>
    </form>
    </body>
</html>
